﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AzureGames.Model;

namespace AzureGames.Data
{
    public interface INotificationRepository
    {
        void Attach(string playerID);
        void Detach(string playerID);
        void PostNotification(Notification message);
        event NotifyEventHandler NotifyEvent;
        void PushNotifications(string playerID);
        void UpdateState(Guid messageID, Notification.STATE state);
    }

    /// <summary>
    /// eventhandler for posting messages to an observer of the notificationrepository
    /// </summary>
    /// <param name="sender">this</param>
    /// <param name="args">the message</param>
    /// <returns>true if the observer successfully received the message and the message should be marked as delivered</returns>
    public delegate bool NotifyEventHandler(INotificationRepository sender, NotifyEventArgs args);

    public class NotifyEventArgs : EventArgs
    {
        public Notification Message { get; set; }
    }
}
